<?php

namespace App\Models;

use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model;

class UserLoginErrorRecord extends Model
{
    use HasDateTimeFormatter;
    // use SoftDeletes;
    const CREATED_AT = 'create_time';
    const UPDATED_AT = 'update_time';

    public $timestamps = true;

    protected $table = 'eb_users_login_error_record';

    protected $fillable = [
        'id',
        'username',
        'ip',
        'create_time',
        'update_time',
        'delete_time',
        'lock_status',
        'lock_time',
        'lock_count',
    ];

    /**
     * 只查询删除时间为空的作用域。
     *
     * @param  \Illuminate\Database\Eloquent\Builder  $query
     * @return \Illuminate\Database\Eloquent\Builder
     */
    public function scopeDelete($query)
    {
        return $query->whereNull('delete_time');
    }
}
